﻿/*
   绑定视图：MainNotice.xaml
   文件说明：通知消息
*/

using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using GalaSoft.MvvmLight.Messaging;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZFSDomain.Common.UserControls;
using ZFSDomain.Common.UserControls.Common;
using ZFSDomain.SysModule;

namespace ZFSDomain.ViewModel.Step
{
    public class NoticeViewModel : ViewModelBase
    {
        public NoticeViewModel()
        {
            _NoticeModels = new ObservableCollection<NoticeModel>();
            _NoticeModels.Add(new NoticeModel() { IconName = "\xe733", Count = "0", ApplyCommand = FullCommand });
            _NoticeModels.Add(new NoticeModel() { IconName = "\xe625", Count = "3", ApplyCommand = NoticeCommand });
            _NoticeModels.Add(new NoticeModel() { IconName = "\xe608", Count = "14", ApplyCommand = MessageCommand });
        }

        private ObservableCollection<NoticeModel> _NoticeModels;

        public ObservableCollection<NoticeModel> NoticeModels
        {
            get { return _NoticeModels; }
        }

        public RelayCommand FullCommand { get; } = new RelayCommand(() => Full());

        public RelayCommand NoticeCommand { get; } = new RelayCommand(() => OpenNotice());

        public RelayCommand MessageCommand { get; } = new RelayCommand(() => OpenMessage());

        public static StateType _StateType = StateType.Expand;

        /// <summary>
        /// 全屏
        /// </summary>
        public static void Full()
        {
            if (_StateType.Equals(StateType.PackUp))
                _StateType = StateType.Expand;
            else
                _StateType = StateType.PackUp;
            Messenger.Default.Send<StateType>(_StateType, "FullScreen");
        }

        public static void OpenNotice()
        {
            NoticeBox notice = new NoticeBox();
            notice.DataContext = new BaseDialogOperation();
            notice.ShowDialog();
        }

        public static void OpenMessage()
        {
            MessagesBox messages = new MessagesBox();
            messages.DataContext = new BaseDialogOperation();
            messages.ShowDialog();
        }

    }

    public enum StateType
    {
        /// <summary>
        /// 收起
        /// </summary>
        PackUp,

        /// <summary>
        /// 展开
        /// </summary>
        Expand,
    }

    /// <summary>
    /// 通知窗口类型
    /// </summary>
    public class NoticeModel : ViewModelBase
    {
        private string _IconName;
        private string _Count;

        /// <summary>
        /// 字体代码[显示LOGO]
        /// </summary>
        public string IconName
        {
            get { return _IconName; }
            set { _IconName = value; RaisePropertyChanged(); }
        }

        /// <summary>
        /// 功能名称
        /// </summary>
        public string Count
        {
            get { return _Count; }
            set
            {
                _Count = value; RaisePropertyChanged();
            }
        }

        public RelayCommand ApplyCommand { get; set; }
    }
}
